import psutil
import json
import datetime
import os
import socket
from flask_script import commands

from app.machines.mac import MacInfo
import subprocess
import platform

class MachineInfo:
    """
    机器信息获取
    """
    def get_machine_info():
        machine_dict = {}

        machine_dict['mac_code'] = MacInfo.get_mac()
        machine_dict['machine_name'] = socket.gethostname()

        return machine_dict

if __name__ == '__main__':
    machines = MachineInfo.get_machine_info()
    # json.dumps(dict)将dict转成str
    machine_json = json.dumps(machines)
    print(machine_json)
